
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)





Facebook聊天[#](#facebook-chat "Permalink to this headline")
==========================================================

> 
> [Messenger](https://en.wikipedia.org/wiki/Messenger_(software))是由`Meta Platforms`开发的美国专有即时通讯应用和平台。最初在2008年被开发为`Facebook Chat`，该公司于2010年进行了其消息服务的改进。
> 
> 
> 

本教程涵盖了如何将数据从[Facebook聊天](https://www.facebook.com/business/help/1646890868956360)加载到可以被LangChain摄取的格式中。

```python
#pip install pandas

```

```python
from langchain.document_loaders import FacebookChatLoader

```

```python
loader = FacebookChatLoader("example_data/facebook_chat.json")

```

```python
loader.load()

```

```python
[Document(page_content='User 2 on 2023-02-05 03:46:11: Bye!  User 1 on 2023-02-05 03:43:55: Oh no worries! Bye  User 2 on 2023-02-05 03:24:37: No Im sorry it was my mistake, the blue one is not for sale  User 1 on 2023-02-05 03:05:40: I thought you were selling the blue one!  User 1 on 2023-02-05 03:05:09: Im not interested in this bag. Im interested in the blue one!  User 2 on 2023-02-05 03:04:28: Here is $129  User 2 on 2023-02-05 03:04:05: Online is at least $100  User 1 on 2023-02-05 02:59:59: How much do you want?  User 2 on 2023-02-04 22:17:56: Goodmorning! $50 is too low.  User 1 on 2023-02-04 14:17:02: Hi! Im interested in your bag. Im offering $50. Let me know if you are interested. Thanks!  ', metadata={'source': 'example_data/facebook_chat.json'})]

```

